package com.cloud.gatewaySpringSecurity.service.Impl;

import com.cloud.gatewaySpringSecurity.mapper.PowerMapper;
import com.cloud.gatewaySpringSecurity.pojo.SystemAuthority;
import com.cloud.gatewaySpringSecurity.service.PowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhozixiong
 * @date 2023/03/03
 */
@Service
public class PowerServiceImpl implements PowerService {

    @Autowired
    private PowerMapper powerMapper;

    @Override
    public List<SystemAuthority> selectPowerByUid(String uid) {
        List<String> list = powerMapper.selectPowerByUid(uid);
        List<SystemAuthority> authorityList = new ArrayList<>();
        for(String str : list) {
            authorityList.add(new SystemAuthority(str));
        }
        return authorityList;
    }
}
